package ws.jdbc.concurrent.driver.sqlserver.cursor.individual

import ws.jdbc.concurrent.driver.sqlserver.*

/**
 * Test case of CursorForwardOnlyReadOnly class methods.
 * 
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
class CursorForwardOnlyReadOnlyTest extends ForwardOnlyReadOnlyTest {
  
  /**
   * Run this before every test.
   */
  @Override
  void setUp() {
    super.setUp()

    stmt = con.createStatement()
    stmt.executeQuery(sqlQuery)
    rs = stmt.getCursor()

    assertNotNull rs
    assertTrue rs instanceof CursorForwardOnlyReadOnly
  }

   /**
   * Test of previous() method for multiple threads.
   */
  void testNextTheads() {
    println "testNextThreads()"

    runThreads {
      def c = stmt.getCursor()
      c.lock()
      
      assertTrue c.next()
      assertLineValuesMatch c, c.getRow()

      c.unlock()
    }
  }
}

